{% extends 'base.html' %}
		{% import 'bootstrap/wtf.html' as wtf %}
		{% block head %}
				{{ super() }}
		{% endblock head %}

{% block content %}
<div class="container">
<div class="row">
<div class="col-md-4">
<img class="img-rounded " src="{{ user.avatar }}">
{%if user == current_user%}
   <form action="{{ url_for('main.change_avatar')}}" method=post enctype=multipart/form-data>
        <input value="选择头像" type=file name=file><br/>
        <input value="上传头像" type=submit value=Upload>
    </form>
{% endif %}
</div>
<div class="col-md-8">
{# <h2>{{ current_user.username }}</h2> #}
<h2>个人信息：</h2>
	<p>用户名:{{user.username}}</p>	
	{% if user.real_name or user.location %}
	<p>
		{% if user.real_name %}	{{ user.real_name}} {% endif %}
		{% if user.location %}
	 From <a href="http://maps.google.com/?q={{ user.location }}">{{ user.location }}</a>
		{% endif %}
	</p>
	{% endif %}
	{% if user.about_me %} 
	<p>个人说明 ：{{user.about_me}}</p>
	{% endif %}
	<p>
		注册时间:{{ moment(user.register_date).format('L')}},
		上一次在线:{{ moment(user.last_seen).fromNow()}}.	
	</p>
	<p>
		共发布了{{user.articles.count() }} 篇博客
	</p>
	{% if current_user.can(Permission.FOLLOW) and user != current_user %}
		{% if not current_user.is_following(user) %}
			<a href="{{url_for('.follow',username=user.username)}}" class="btn btn-primary"> 关注 </a>
		{% else %}
			<a href="{{ url_for('.unfollow',username=user.username)}}" class="btn btn-default">不再关注</a>
		{% endif %}
	{% endif %}
	<a href="{{ url_for('.followers',username=user.username) }}">关注他的人:<span class="badge">{{ user.followers.count() }}</span></a>
	<a href="{{ url_for('.followed_by',username=user.username) }}">关注的人:<span class="badge">{{ user.followed.count() }}</span></a>
	{% if current_user.is_authenticated and user != current_user and user.is_followed_by(current_user) %}
		| <span class="label label-default">已关注</span>
	{% endif %}
	<br>
	{% if user == current_user %}
	<a class="btn btn-default" href="{{ url_for('.edit_profile') }}">
	编辑资料
	</a>
	{% endif %}
	</div>
</div>
{% endblock %}
